Create Assets and associated records
Introduction
The Assetic REST API endpoints allow per record creation of Assets and associated records such as components and dimensions.
The following endpoints are available for the creation of these records:
- POST /api/v2/assets
- POST /api/v2/components
- POST /api/v2/components/{id}/dimensions
Please read the article Asset Integration Overview if unclear how these endpoints relate to the asset structure in Assetic.
These API's are intended for syncing assets with external applications where the asset is first created in the external application, such as the GIS. These API endpoints are real-time in that the asset is created immediately and returns key identifiers such as the Assetic unique system asset GUID, component GUID, and dimension GUID, and/or the user visible friendly ID's. This allows the external application to record the Assetic ID's for the newly created records.
There is rate limit applied to the Assetic REST API's which should be considered when attempting to create a large number of records.
The process described in Data-Exchange-Integration should be used for data migration projects or large volume transactions.
POST /api/v2/assets
Asset Fields
The API POST /api/v2/assets creates the asset, which is comprised of the core asset fields and a set of attribute fields relevant to the asset category. Note that some of these non-core asset attribute fields are still common to all categories. The core asset fields are listed in the article Asset Integration Overview.
The non-core asset attribute fields are included in the request as an object containing key-value pairs where attribute name is the key.
Asset Status
When creating the asset, the initial status of the asset may be set to one of:
- Notional Asset
- Proposed
- Active
If Status is not defined in the payload then the asset will be created with the default status of 'Active'.
Sample Payload
The following sample creates a new asset with core fields defined plus 'Link' and 'Comment' attributes.
{ "AssetId": "RINT05", "AssetName": "Kevin Road 5", "Status": "Active", "AssetCategory": "Roads", "AssetClass": "Transport", "AssetSubClass": "Road", "AssetType": "Unsealed Road", "AssetSubType": "Gravel", "AssetCriticality": "Arterial", "AssetWorkGroup": "Roads", "WorkGroups": [ "Roads", "Road Maintenance" ], "AssetMaintenanceType": "Road", "AssetMaintenanceSubType": "Arterial Road", "Attributes": { "Link": "www.assetic.com", "Comment": "a comment" }, "AssetExternalIdentifier": "ext05" }
POST /api/v2/components
Component Creation
Having created an asset, each component is created one at a time for the asset.
Sample payload
The following sample payload creates a new component against the asset "41010119".
The component type is "Surface Main". The type is user defined on a per category basis (via the 'Admin' module), and the component type may not be assigned to an asset more than once.
{ "DimensionUnit": "Metre", "DesignLife": 50, "ComponentType": "Surface Main", "ExternalIdentifier": "Ext41010119CMP2", "AssetId": "41010119", "NetworkMeasureType": "Length", "Label": "Surface Component", "MaterialType": "Asphalt" }
POST /api/v2/components/{id}/dimensions
The dimension records for a component are added one at a time.
The following sample payload creates a new length dimension for a component.
Sample payload
URL:
POST /api/v2/components/85e31c31-821d-e711-946c-06edd62954d7/dimensions
Request Body:
{ "Unit": "Metre", "Multiplier": 2, "ComponentId": "85e31c31-821d-e711-946c-06edd62954d7", "Comments": "Created via API", "NetworkMeasureType": "Length", "RecordType": "Addition", "NetworkMeasure": 50 }